home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15625 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: opengovt.open.org!john
  2. From: THayworth@open.org (Tina Hayworth)
  3. Newsgroups: comp.lang.c++
  4. Subject: Large string as a DLL parameter
  5. Date: 6 Apr 1996 18:03:29 GMT
  6. Organization: OPEN.ORG
  7. Message-ID: <4k6blh$ilv@hp_open.open.org>
  8. NNTP-Posting-Host: 199.2.103.4
  9. Mime-Version: 1.0
  10. Content-Type: Text/Plain; charset=US-ASCII
  11. X-Newsreader: WinVN 0.99.7
  12.  
  13. I am not an experienced C++ programmer, but I have taken a couple C 
  14. classes a few years ago.  I need to write a simple DLL that will be called by 
  15. VB.
  16.  
  17. I found some sample code, wrote the program, and it worked - I thought I had 
  18. it all figured out. But if I try passing a pointer to a large string to a 
  19. function in the DLL, I get a GPF.
  20.  
  21. In the code below, if commarea is 40 bytes or less it works.  If it is larger 
  22. I get a GPF.  The actual string I need to pass is 11,452 bytes.
  23.  
  24. Can anyone tell me what I am doing wrong?
  25.  
  26. Here is the function I am calling:
  27.  
  28. int FAR PASCAL EciSync (char server[], char userid[], char passwd[],
  29.                         char program[], char transid[], char *commarea, int 
  30. comsize)
  31. ---------------------------------------------------------------------------
  32. Here is my DEF file:
  33.  
  34. LIBRARY  ECIDLLL
  35.  
  36. EXETYPE WINDOWS 
  37.  
  38. SEGMENTS
  39.         WEPSEG      PRELOAD FIXED
  40.  
  41. CODE    PRELOAD MOVEABLE DISCARDABLE
  42. DATA    PRELOAD MOVEABLE SINGLE
  43.  
  44. HEAPSIZE 5120
  45.  
  46. EXPORTS
  47.         WEP             @1     RESIDENTNAME
  48.         EciSync         @2
  49. ------------------------------------------------------------------------
  50. Here is the Declaration in VB:
  51.  
  52. Declare Sub EciSync Lib "ecidll.dll" (ByVal S As String, ByVal U As String, 
  53. ByVal P As String, ByVal Pg As String, ByVal T As String, ByVal c As String, 
  54. ByVal S As Integer)                                                      
  55.  
  56.